﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.actions {
    import Classes.*;
    import com.greensock.*;

    public class ActionDie extends NPCAction {

        private static const FADE_LENGTH:Number = 1;

        public function ActionDie(_arg1:NPC){
            super(_arg1);
        }
        override public function enter():void{
            super.enter();
            this.tweenOut();
        }
        override public function reenter():void{
            super.reenter();
            this.tweenOut();
        }
        protected function tweenOut():void{
            var me:* = null;
            var npcSeaVehicle:* = null;
            var npcTourBus:* = null;
            var npcCloud:* = null;
            me = this;
            TweenLite.to(m_npc, FADE_LENGTH, {
                alpha:0,
                onComplete:function ():void{
                    Global.world.citySim.npcManager.removeNpc(m_npc);
                    m_npc.getStateMachine().removeState(me);
                }
            });
            if ((m_npc is SeaVehicle)){
                npcSeaVehicle = SeaVehicle(m_npc);
                Ship.decrementShipCounter(npcSeaVehicle);
            };
            if ((m_npc is TourBus)){
                npcTourBus = TourBus(m_npc);
                Business.decrementBusCounter();
            };
            if ((m_npc is Cloud)){
                npcCloud = Cloud(m_npc);
                CloudManager.removeCloud(npcCloud);
            };
        }

    }
}//package Classes.actions 
